//==============================================================================
#include "HRTimer.h"
#include <windows.h>

//==============================================================================
double HRTimer::LIToSecs( LARGE_INTEGER & L) {
	return ((double)L.QuadPart /(double)frequency.QuadPart);
}
//------------------------------------------------------------------------------
HRTimer::HRTimer(){
	timer.start.QuadPart=0;
	timer.stop.QuadPart=0;	
	QueryPerformanceFrequency( &frequency );
}
//------------------------------------------------------------------------------
void HRTimer::startTimer( ) {
    QueryPerformanceCounter(&timer.start);
}
//------------------------------------------------------------------------------
void HRTimer::stopTimer( ) {
    QueryPerformanceCounter(&timer.stop);
}
//------------------------------------------------------------------------------
double HRTimer::getElapsedTime() {
	LARGE_INTEGER time;
	time.QuadPart = timer.stop.QuadPart - timer.start.QuadPart;
    return LIToSecs( time) ;
}
